package seed_partner_admin

import (
	"fmt"
	"gitee.com/theegg/go-brick/app/model/partner/partner_admin/partner_admin_role_users"
	"gitee.com/theegg/go-brick/app/service/app"
)

func InitPartnerAdminRoleUsersSeed() {
	items := make(map[int]partner_admin_role_users.PartnerAdminRoleUsers)

	items[1] = partner_admin_role_users.PartnerAdminRoleUsers{
		Id:     1,
		UserId: 1,
		RoleId: 1,
	}

	items[2] = partner_admin_role_users.PartnerAdminRoleUsers{
		Id:     2,
		UserId: 2,
		RoleId: 1,
	}

	items[3] = partner_admin_role_users.PartnerAdminRoleUsers{
		Id:     3,
		UserId: 3,
		RoleId: 2,
	}

	count := 0
	errCount := 0
	for _, item := range items {
		_, err := app.Db().Insert(item)
		if err != nil {
			fmt.Println(err.Error())
			errCount++
		} else {
			count++
		}
	}

	fmt.Printf("%5s|%25s|%10d|%8d|\n", "", "partner_admin_role_users", count, errCount)
}
